package org.soarsky.wealthchengdu.module.guide;

import org.soarsky.wealthchengdu.R;
import org.soarsky.wealthchengdu.google.map.DataUtils;
import org.soarsky.wealthchengdu.google.map.GoogleMapActivity;
import org.soarsky.wealthchengdu.google.map.MapUtils;

import android.app.Activity;
import android.app.ActivityGroup;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

public class GuideDelitActivity extends ActivityGroup implements OnClickListener {
	private TextView titeltv;// 标题
	private ImageView Image;// 图片
	private Button leftbtn;
	private Button contentbtn;
	private Button rightbtn;
	private ImageView titleRteurn;// 返回按钮
	//private FrameLayout mContainer;
	public static enum ActivityID {
		// 注册Activity区 开始
		GOOGLE_MAP,
		GAODE_MAP,
		MAX_REGISTER_COUNT,
		// 非注册Activity请在下面增加

	}
    private LinearLayout guidelinearlayout;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_guidelit);
		initview();
		
	}
	private void showMapView(){
		guidelinearlayout.removeAllViews();
	
		
		if(MapUtils.isEnableGoogleMap()){
			Intent intent = new Intent(this,GoogleMapActivity.class);
			intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
			View view = this.getLocalActivityManager()
					.startActivity(ActivityID.GOOGLE_MAP.toString(), intent).getDecorView();
			guidelinearlayout.addView(view);
			GoogleMapActivity.getInstance().openMap(DataUtils.MEETING);
		}else{
			Intent intent = new Intent(this,GAODEMapActivity.class);
			intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
			intent.putExtra(GAODEMapActivity.MAP_STATUS, GAODEMapActivity.MAP_MEETING);
			View view = this.getLocalActivityManager()
					.startActivity(ActivityID.GAODE_MAP.toString(), intent).getDecorView();
			guidelinearlayout.addView(view);
			//MapActivity.getInstance().openMap(DataUtils.MEETING);
		}
		
	}
	private void initview() {

		titeltv = (TextView) findViewById(R.id.activity_delittitel_tv);
		Image = (ImageView) findViewById(R.id.activity_delitimage_img);
		titleRteurn= (ImageView) findViewById(R.id.title_iv_img);
		leftbtn = (Button) findViewById(R.id.activity_leftbtn);
		contentbtn = (Button) findViewById(R.id.activity_contentbtn);
		rightbtn = (Button) findViewById(R.id.activity_rightbtn);
		guidelinearlayout = (LinearLayout)findViewById(R.id.activity_guide_liearlyout);
		
		leftbtn.setTextColor(Color.RED);
		titeltv.setText("客服hd声卡粉红色考核方式空间粉红色");
		Image.setImageResource(R.drawable.focus_image);

		leftbtn.setOnClickListener(this);
		contentbtn.setOnClickListener(this);
		rightbtn.setOnClickListener(this);
		titleRteurn.setOnClickListener(this);
	}

	@Override
	public void onClick(View view) {
		switch (view.getId()) {
		case R.id.activity_leftbtn:
			leftbtn.setBackgroundResource(R.drawable.tab_clickone);
			contentbtn.setBackgroundResource(R.drawable.tab_backtwo);
			rightbtn.setBackgroundResource(R.drawable.tab_backthree);
			leftbtn.setTextColor(Color.RED);
			contentbtn.setTextColor(Color.BLACK);
			rightbtn.setTextColor(Color.BLACK);
			break;
		case R.id.activity_contentbtn:
			leftbtn.setBackgroundResource(R.drawable.tab_backone);
			contentbtn.setBackgroundResource(R.drawable.tab_clickotwo);
			rightbtn.setBackgroundResource(R.drawable.tab_backthree);
			leftbtn.setTextColor(Color.BLACK);
			contentbtn.setTextColor(Color.RED);
			rightbtn.setTextColor(Color.BLACK);
			break;
		case R.id.activity_rightbtn:
			
			leftbtn.setBackgroundResource(R.drawable.tab_backone);
			contentbtn.setBackgroundResource(R.drawable.tab_backtwo);
			rightbtn.setBackgroundResource(R.drawable.tab_clickthree);
			leftbtn.setTextColor(Color.BLACK);
			contentbtn.setTextColor(Color.BLACK);
			rightbtn.setTextColor(Color.RED);
			
			showMapView();
			break;
		case R.id.title_iv_img:
			GuideDelitActivity.this.finish();
			break;
		}

	}
}
